package com.example.test.dialogfactory;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import easier.app.x.CommonCode;
import easier.log.logger.Logger;

public class MainActivity75 extends AppCompatActivity {

    private Button mClick00;

    public static void start( Context context ) {

        Intent starter = new Intent( context, MainActivity75.class );
        context.startActivity( starter );
    }

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main75 );
        initView();
        initViewAction();
    }

    private void initView() {

        mClick00 = (Button) findViewById( R.id.click00 );
    }

    private void initViewAction() {

        mClick00.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "appx://" ) );
                startActivity( intent );
            }
        } );
    }

    @Override
    protected void onNewIntent( Intent intent ) {

        super.onNewIntent( intent );
        Uri data = intent.getData();
        Logger.i( "onNewIntent: " + data );
        if ( data != null ) {
            Logger.i( data.toString() );
            CommonCode.showToast( this, data.toString() );
        }
    }
}